Getting Started

Deploying a Smart Contract

Resources

MyEtherWallet

VS Code

VS Code Solidity Extension

Get some GO — Ask for some free testnet GO in our Testnet Telegram or buy some on KuCoin to deploy to mainnet

Deploying

Sample Solidity Code

pragma solidity ^0.4.20;

contract MyToken {
    /* This creates an array with all balances */
    mapping (address => uint256) public balanceOf;

    /* Initializes contract with initial supply tokens to the creator of the contract */
    constructor() public {
        uint256 initialSupply = 10000;
        balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
        totalSupply = initialSupply;
    }

    /* Send coins */
    function transfer(address _to, uint256 _value) public returns (bool success) {
        require(balanceOf[msg.sender] >= _value);           // Check if the sender has enough
        require(balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
        balanceOf[msg.sender] -= _value;                    // Subtract from the sender
        balanceOf[_to] += _value;                           // Add the same to the recipient
        return true;
    }
}

Compile the code

  1. Compile the code by clicking on 'compile' or pressing F5
  2. This will create a few files in a bin/ directory, open MyToken.bin. This contains your contract bytecode, which you’ll use below.

Deploy your Contract

This is really easy using the GoChain Wallet:

Testnet Screenshot

  1. In the top right, choose TestNet
  2. Click Open Wallet
  3. Paste your private key for your testnet wallet that has the GO you got from our Telegram
  4. Click Deploy Contract
  5. Copy the contents of MyToken.bin into the Bytecode field
  6. Click Send!

Contract Address

Example: 0xd0a6e6c54dbc68db5db3a091b171a77407ff7ccf

Using your new GoChain Contract

  1. Send GO directly.
  2. Deploy a DApp
  3. Using MyEthereWallet
  4. Using GoChain Wallet